<!--
 * @Description  : 
 * @Author       : 彭浩
 * @Date         : 2020-09-22 14:25:44
 * @LastEditTime : 2020-12-17 14:53:45
 * @LastEditors  : 彭浩
 * @FilePath     : \cloud-design-center-portal\src\views\main\index.vue
-->
<template>
    <div class="main">
        <top-info ref="topInfo" />
        <newer-guide :class="{ active: showNewerGuide }" />
 
        <div class="main-content">
            <!-- 子应用视图 -->
            <div id="subapp-view" class="main-container-view"></div>
        </div>
    </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
import TopInfo from "./components/topInfo.vue";
import NewerGuide from "./components/newerGuide";
import { mapGetters } from "vuex"; // 引入状态共享

export default {
    name: "main-page",

    components: {
        TopInfo,
        NewerGuide,
    },
    computed: {
           ...mapGetters(["userInfo"]),
    },
    data: () => ({
        showNewerGuide: false // 是否显示新手引导
    }),
    created() {
        this.showNewerGuide = this.userInfo.showGuideFlag !== 1;
        //this.mockLogin();
        // this.$alert("sss", "标题名称", {
        //     confirmButtonText: '确定',
        //   callback: action => {

        //   }
        // })
    },
    mounted() {
        this._closeNoviceGuideCalled = false;
    },
    watch: {},
    methods: {
        // 关闭或打开新手引导说明
        triggerNewerGuide() {
            this.showNewerGuide = !this.showNewerGuide;

            if (
                this.userInfo.showGuideFlag !== 1 &&
                !this._closeNoviceGuideCalled
            ) {
                this.api.closeNoviceGuide({}, { method: "get" });
                this._closeNoviceGuideCalled = true;
            }
        }
    },
};
</script>

<style lang="scss" src="@/assets/styles/main/index.scss" scoped></style>
